package top.cardone.api.v1.usercenter.department

import top.cardone.context.ApplicationContextHolder
import top.cardone.usercenter.service.DepartmentService

class r0003 implements java.io.Serializable {
    def input(input) {
        input
    }

    def validation(input) {
    }

    def func(input) {
        ApplicationContextHolder.getBean(DepartmentService.class).findListForTree(input)
    }

    def output(output) {
        def newOutput = []

        for (def outputItem : output) {
            newOutput.add(['name': outputItem['name'], 'id': outputItem['department_code'], 'pId': outputItem['parent_code'], 'childrenCount': outputItem['children_count']])
        }

        newOutput
    }
}